package com.stone.design.mode.state;

/**
 * 门关闭状态
 *
 * @author Mr_wenpan@163.com 2022/01/13 22:42
 */
public class ClosingState extends LiftState {

    @Override
    public void close() {
        System.out.println("电梯门关闭动作....");
    }

    @Override
    public void open() {
        // 置为敞开门状态
        super.context.setLiftState(Context.OPENING_STATE);
        // 委托给环境中的状态去执行open
        super.context.getLiftState().open();
    }

    @Override
    public void run() {
        super.context.setLiftState(Context.RUNNING_STATE);
        super.context.getLiftState().run();
    }

    @Override
    public void stop() {
        super.context.setLiftState(Context.STOPPING_STATE);
        super.context.getLiftState().stop();
    }
}
